<template>
  <!--  添加银行卡-->
  <div>

    <div style="width: 100%;height: 80px;">
        <span style="float: left;margin-top: 25px;margin-left: 15px;font-size: 35px" @click="towalletindex">
          &lt;
        </span>
      <span style="float: right;margin-top: 25px;margin-right: 150px;font-size: 25px;font-weight: bold">
        添加银行卡
        </span>
    </div>
    <div style="width: 100%; height: 840px;background: #f3fcff;overflow: hidden;">

      <span style="margin-top: 25px;float:left;margin-left:50px;font-size: 25px;font-weight: bold">请输入卡号绑定</span>
      <div>
        <input type="text" v-model="driversWallet.bankCardNumber" placeholder="请输入卡号" style="width: 300px;height: 40px;margin-top: 10px"/>
      </div>

      <el-button type="1primary" round style="margin-top: 25px;width: 330px;background: #4ea9cb;color: white;"
                 @click="addbankcard"
      >确定
      </el-button>


    </div>
  </div>
</template>
<script>
import {walletadd} from "@/components/api/wallet/wallet";
// @zhaomingshuo
export default {
  data() {
    return {
      driversWallet: {},

    };
  },
  methods: {
    // 添加银行卡
    addbankcard(){
      var user = JSON.parse(window.localStorage.getItem("personalUser"));
      this.driversWallet.userId=user.id;




      walletadd(this.driversWallet).then(res=>{
        if (res.data==1){
          this.$message({
            message: "添加成功",
            type: 'success',
            duration:800
          });
          this.$router.push({
            path: '/walletindex',
          })
        }
        if (res.data==2) {
          this.$message({
            message: "请输入正确的银行卡号",
            type: 'warning',
            duration:800
          });
        }
        if (res.data==3) {
          this.$message({
            message: "请输入的银行卡号",
            type: 'warning',
            duration:800
          });
        }
        if (res.data==0) {
          this.$message({
            message: "网络错误!",
            type: 'warning',
            duration:800
          });
        }
      })


    },
    // 跳转到钱包页面
    towalletindex() {
      this.$router.push({
        path: '/walletindex',
      })
    }
  },
  created() {

  }

};
</script>
<style>

</style>